﻿using System;
using VMind.Global;
using System.Data;
using PPI.Data;

namespace PPI.ServiceLogic
{
    public static class LVendor_Visit_XMissionStructures_Pole
    {
        #region CRUD

        public static Int32 Save(Int32 poleId, Int32 assetId, Int32 topTypeId,Int32 speciesId, Int32 treatmentId, Int32 year, Int32 classId,double latitude, double longitude, double altitude, Int32 satelliteCount,DateTime satelliteTime, string aid, Int32 lvisit, string number, double length,string lvisitor,bool solutionAvailable, string connectionKey)
        {
            Int32 returnId = poleId;
            if (poleId == Int32.MinValue)
            {
                returnId = Insert(assetId, topTypeId, speciesId, treatmentId, year, classId, latitude, longitude, altitude, satelliteCount, satelliteTime, aid, lvisit, number, length, lvisitor, solutionAvailable, connectionKey);
            }
            else
            {
                Update(poleId,assetId, topTypeId, speciesId, treatmentId, year, classId, latitude, longitude, altitude, satelliteCount, satelliteTime, aid, lvisit, number, length, lvisitor, solutionAvailable, connectionKey);
            }
            return returnId;
        }

        private static int Insert(Int32 assetId, Int32 topTypeId,Int32 speciesId, Int32 treatmentId, Int32 year, Int32 classId,double latitude, double longitude, double altitude, Int32 satelliteCount,DateTime satelliteTime, string aid, Int32 lvisit, string number, double length,string lvisitor,bool solutionAvailable, string connectionKey)
        {

            return DVendor_Visit_XMissionStructures_Pole.Insert(assetId, topTypeId, speciesId, treatmentId, year, classId, latitude, longitude, altitude, satelliteCount, satelliteTime, aid, lvisit, number, length, lvisitor, solutionAvailable, connectionKey); 
        }

        private static void Update(Int32 poleId, Int32 assetId, Int32 topTypeId, Int32 speciesId, Int32 treatmentId, Int32 year, Int32 classId, double latitude, double longitude, double altitude, Int32 satelliteCount, DateTime satelliteTime, string aid, Int32 lvisit, string number, double length, string lvisitor, bool solutionAvailable, string connectionKey)
        {

            DVendor_Visit_XMissionStructures_Pole.Update(poleId,assetId, topTypeId, speciesId, treatmentId, year, classId, latitude, longitude, altitude, satelliteCount, satelliteTime, aid, lvisit, number, length, lvisitor, solutionAvailable, connectionKey);
        }

        public static void Delete(Int32 poleId, string connectionKey)
        {

            //DVendor_Visit_XMissionStructures_Pole.DesaocciateImages(poleId, connectionKey);
            DVendor_Visit_XMissionStructures_Pole.Delete(poleId, connectionKey);
        }

        #endregion

    }
}
